package com.swu.hc.data_dataType_dataOperate;

public class equals_operate{
	public static void main(String[] args) {
		equals_student equals_student=new equals_student(1, "aa");
		equals_student equals_student2=new equals_student(1, new String("aa"));
		System.out.println(equals_student==equals_student2);
		System.out.println(equals_student.equals(equals_student2));
	}
}

class equals_student {
	private int id;
	private String nameString;
	public equals_student() {
		// TODO Auto-generated constructor stub
	}
	public equals_student(int id,String nameString){
		this.id=id;
		this.nameString=nameString;
	}
	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		equals_student student=(equals_student)obj;
		return (id!=student.id ? false:(nameString.equals(student.nameString)));
	}
}
